package com.crm.sms.biz.impl;

import com.crm.sms.SMSResult;
import com.crm.sms.biz.SMSClient;
import com.ruoyi.common.exception.UtilException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

@Service
public class MockSMSClient implements SMSClient {

    private static final Logger logger = LoggerFactory.getLogger(MockSMSClient.class);

    @Override
    public SMSResult sendRegisterVerify(String phone, String verifyCode) throws UtilException {
        return send(phone, verifyCode);
    }

    @Override
    public SMSResult sendBindPhoneVerify(String phone, String verifyCode) throws UtilException {
        return send(phone, verifyCode);
    }

    @Override
    public SMSResult sendResetPasswordVerify(String phone, String verifyCode) throws UtilException {
        return send(phone, verifyCode);
    }

    @Override
    public SMSResult sendAdminLoginVerify(String phone, String verifyCode) throws UtilException {
        return send(phone, verifyCode);
    }

    public SMSResult send(String phone, String verifyCode) {
        logger.info("[模拟短信发送] phone=" + phone + "; verifyCode=" + verifyCode);
        SMSResult smsResult = new SMSResult();
        smsResult.setSucc(true);
        smsResult.setMsg("OK");
        return smsResult;
    }
}
